#ifndef TINYXMLMANAGER_H
#define TINYXMLMANAGER_H

#include"tinyxml/tinyxml.h"
#include"tinyxml/tinystr.h"
#include"xml_struct.h"
#include <sstream>

//测试xml用例
class TinyXMLManager
{
public:
    TinyXMLManager();
    ~TinyXMLManager();

//纯C tinyXML  写入，加载，修改
public:
    //第一种一个函数
    // 保存结构体为 XML 的函数
    bool saveAttendeeToXML(const Attendee& attendee, const std::string& filePath);
    // 加载 XML 文件到结构体的函数
    bool loadAttendeeFromXML(Attendee& attendee, const std::string& filePath);
    // 打印结构体的函数
    void printAttendee(const Attendee& attendee);

    bool updateAttendeeInXML(const std::string& filePath,
                                             const std::string& fieldToUpdate,const std::string& newValue);

    //第二种，两个函数
    // 函数一：将 Attendee 结构体转换为 TiXmlElement
    TiXmlElement* saveAttendeeToXMLElement(const Attendee &attendee);
    // 函数二：将 TiXmlDocument 保存到 XML 文件,可二合一
    bool saveXMLElementToXMLFile(TiXmlDocument &doc, const std::string &filePath);
    bool saveXMLElementToXMLFile(const Attendee& attendee, const std::string &filePath);



    // 保存 Meeting 结构体为 XML
    bool saveMeetingToXML(const Meeting& meeting, const std::string& filePath);
    // 加载 XML 文件到 Meeting 结构体
    bool loadMeetingFromXML(Meeting& meeting, const std::string& filePath);
    // 打印 Meeting 结构体的函数
    void printMeeting(const Meeting& meeting);


    string getToString(int value);
    string getToString(short value);
    string getToString(long value);
    string getToString(long long value);
    string getToString(float value);
    string getToString(double value);
    string getToString(bool value);
    string getToString(char value);


    string getToString(unsigned char value);
    string getToString(unsigned short value);
    string getToString(unsigned int value);
    string getToString(unsigned long value);
    string getToString(unsigned long long value);


    string getToString(signed char value);
    string getToString(const char* value);
    string getToString(const unsigned char* value, size_t length);



    unsigned char getUnsigneCharFromString(string value);
    unsigned short getUnsigneShortFromString(string value);
    unsigned int getUnsigneIntFromString(string value);
    int getIntFromString(string value);
    short getShorttFromString(string value);
    float getFloatFromString(string value);
    double getDoubleFromString(string value);
    bool getBoolFromString(string value);




//纯qt doc,read,write  写入，加载，修改
public:



};

#endif // TINYXMLMANAGER_H
